package com.api.tag.getdepartmentsfortag;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.ITagApiService;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(locations = { "classpath:/tags/tags-context.xml" })
public class GetDepartmentsForTagExternal extends AbstractApiTest {

	@Value("#{statictags['user.external'].appId}")
	private String externalUrn;

	@Value("#{statictags['user.external'].password}")
	private String externalPassword;

	@Value("#{statictags['category.urn']}")
	private String categoryUrn;

	@Value("#{statictags['location.urn']}")
	private String locationUrn;

	@BeforeClass
	protected void setParameters() throws Exception {

		getApi().login(externalUrn, externalPassword);
	}

	@Test(expectedExceptions = { ZyncroApiException.class })
	public void testGetCategoryDepartments() throws ZyncroApiException {

		int pageNumber = 0;
		int itemsPerPage = 0;

		getApi().getService(ITagApiService.class).getDepartmentsForTag(categoryUrn, pageNumber, itemsPerPage);
	}

	@Test(expectedExceptions = { ZyncroApiException.class })
	public void testGetLocationDepartments() throws ZyncroApiException {

		int pageNumber = 0;
		int itemsPerPage = 0;

		getApi().getService(ITagApiService.class).getDepartmentsForTag(locationUrn, pageNumber, itemsPerPage);
	}
}
